import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:album/utils/provider.dart';

class BottomNavigationWidget extends StatefulWidget {
  const BottomNavigationWidget({Key? key}) : super(key: key);

  @override
  createState() => BottomNavigationWidgetState();
}

class BottomNavigationWidgetState extends State<BottomNavigationWidget> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return BottomAppBar(
      color: Colors.white,
      // shape: const CircularNotchedRectangle(),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          IconButton(
            icon: const Icon(Icons.token_rounded),
            color: Provider.of<GlobalProvider>(context).getCurrentIndex == 0
                ? const Color(0xff38c5bc)
                : const Color(0xFF4C4D4F),
            onPressed: () {
              context.read<GlobalProvider>().setCurrentIndex(0);
            },
          ),
          IconButton(
            icon: const Icon(Icons.receipt_long_sharp),
            color: Provider.of<GlobalProvider>(context).getCurrentIndex == 1
                ? const Color(0xff38c5bc)
                : const Color(0xFF4C4D4F),
            onPressed: () {
              context.read<GlobalProvider>().setCurrentIndex(1);
            },
          ),
          IconButton(
            icon: const Icon(Icons.shopping_bag_outlined),
            color: Provider.of<GlobalProvider>(context).getCurrentIndex == 2
                ? const Color(0xff38c5bc)
                : const Color(0xFF4C4D4F),
            onPressed: () {
              context.read<GlobalProvider>().setCurrentIndex(2);
            },
          ),
          IconButton(
            icon: const Icon(Icons.perm_identity),
            color: Provider.of<GlobalProvider>(context).getCurrentIndex == 3
                ? const Color(0xff38c5bc)
                : const Color(0xFF4C4D4F),
            onPressed: () {
              context.read<GlobalProvider>().setCurrentIndex(3);
            },
          ),
        ],
      ),
    );
  }
}
